<include file="Public/head"/>
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css"/>
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type="text/css">
    .select_model {
        -moz-appearance: none;
        background: rgba(0, 0, 0, 0) url("{:get_style_cdnurl()}paimai/yunying/images/sanjiao.jpg") no-repeat scroll 115px 5px;
        border: 1px solid #d7d7d7;
        float: left;
        height: 26px;
        line-height: 26px;
        margin-right: 8px;
        margin-left: 10px;
        text-indent: 2px;
        width: 136px;
    }

    .select2-container .select2-choice {
        background: #fff url("{:get_style_cdnurl()}paimai/yunying/images/sanjiao.jpg") no-repeat scroll 132px 5px;
        width: 140px;
    }

    .tanShang .daiJingW {
        padding: 20px 0 0 10px;
    }

    .tanShang .daiJingW .tipmsg {
        font-size: 14px;
        padding: 10px 40px 0;
    }
</style>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="clcwht.ztgl"/>

    <div class="mianR">
        <div class="yuyue">
            <ul>
                <li onclick="get_list()" class="yuCurrent">普通问答</li>
                <li onclick='window.location.href="{:U("Topic/checkPayQuestion",["tid"=>$tid])}"'>付费问答</li>
            </ul>
        </div>

        <div class="yuSuo clearfix" style="float:left;">
            <input type="hidden" id="tid" name="tid" value="{$tid}"/>
            <input type="text" id="q_id" name="q_id" placeholder="请输入提问ID" value="" class="suoDian"
                   style="margin:0px;"/>
            <input type="text" id="q_brand" name="q_brand" placeholder="请输入涉及品牌" value="" class="suoDian"/>
            <input type="text" id="q_keywords" name="q_keywords" placeholder="请输入问题概览关键字" value="" class="suoDian"/>
            <input type="text" id="q_uid" name="q_uid" placeholder="请输入提问用户ID" value="" class="suoDian"/>
            <select id="q_reward" name="q_reward" class="select_model">
                <option value="">请选择是否悬赏</option>
                <option value="1">是</option>
                <option value="2">否</option>
            </select>
            <select id="q_accept_status" name="q_accept_status" class="select_model">
                <option value="">请选择采纳状态</option>
                <option value="1">已采纳</option>
                <option value="2">未采纳</option>
            </select><br/><br/>
            <select id="q_status" name="q_status" class="select_model" style="margin-left: 0px;">
                <option value="">请选择提问状态</option>
                <option value="1">启用</option>
                <option value="3">违规禁用</option>
                <option value="4">用户禁用</option>
                <option value="5">举报禁用</option>
            </select>
            <input type="text" id="start_time" name="start_time" value="" readonly placeholder="提问开始时间"/><em></em>
            <input type="text" id="end_time" name="end_time" value="" readonly placeholder="提问结束时间"
                   style="margin-right: 10px;"/>
            <input type="button" id="search" value="搜索" class="suoSou">
        </div>

        <div class="yuList">
            <div class="listBox" id="listBox"></div>
        </div>

        <div class="clear"></div>
    </div>
</div>

<script type="text/javascript">

    function q_disable(id, status) {
        var status_name = '';
        if (status == 3) {
            status_name = '违规禁用';
        } else if (status == 4) {
            status_name = '用户禁用';
        } else {
            status_name = '启用';
        }
        var str = '确定将提问<b style="color:red"> ' + status_name + '</b> 吗？';
        $('#id').val(id);
        $('#status').val(status);
        $('.tipmsg').html(str);
        $('.disable_question').show();
    }

    $('#qd_disable_question').click(function () {
        var id = $('#id').val();
        var status = $('#status').val();
        $(".yunBei").css("display", "block").unbind('click')
        $(".loading").fadeIn();
        $.post('/CommonQuestion/disableQuestion', {'id': id, 'status': status}, function (data) {
            if (data.code == 200) {
                btn_alert(data.msg);
                setTimeout(function () {
                    window.location.reload();
                }, 300);
            } else {
                $(".loading").fadeOut();
                shibai_alert(data.msg);
            }
        }, 'JSON');
    });

    $("#start_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });
    $("#end_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });

    function get_page(p) {
        var url = get_url();
        url += "&p=" + p;
        $.get("/CommonQuestion/commonQuestionList", encodeURI(url), function (data) {
            $("#listBox").html(data);
        }, "html");
    }
    get_list();
    function get_list(status) {
        var url = get_url();
        $.get("/CommonQuestion/commonQuestionList", url, function (data) {
            $("#listBox").html(data);
        }, "html");
    }
    function get_url() {
        var url = "";
        var t_id = $("#tid").val()
        var q_id = $("#q_id").val();
        var q_brand = $("#q_brand").val();
        var q_keywords = $("#q_keywords").val();
        var q_uid = $("#q_uid").val();
        var q_reward = $("#q_reward").val();
        var q_accept_status = $("#q_accept_status").val();
        var q_status = $("#q_status").val();
        var start_time = $("#start_time").val();
        var end_time = $("#end_time").val();
        if (t_id) {
            url += '&tid=' + t_id;
        }
        if (q_id) {
            url += '&q_id=' + q_id;
        }
        if (q_brand) {
            url += '&q_brand=' + q_brand;
        }
        if (q_keywords) {
            url += '&q_keywords=' + q_keywords;
        }
        if (q_uid) {
            url += '&q_uid=' + q_uid;
        }
        if (q_reward) {
            url += '&q_reward=' + q_reward;
        }
        if (q_accept_status) {
            url += '&q_accept_status=' + q_accept_status;
        }
        if (q_status) {
            url += '&q_status=' + q_status;
        }
        if (start_time) {
            url += '&start_time=' + start_time;
        }
        if (end_time) {
            url += '&end_time=' + end_time;
        }
        return url;
    }

    $('#search').on('click', function () {
        get_list();
    });

    function q_top(q_id, is_top) {
        $(".yunBei").css("display", "block").unbind('click')
        $(".loading").fadeIn();
        var post_data = {'q_id': q_id, 'is_top': is_top};
        $.post('/CommonQuestion/commonQuestionTop', post_data, function (data) {
            if (data.code == 200) {
                btn_alert(data.msg);
                setTimeout(function () {
                    window.location.reload();
                }, 300);
            } else {
                $(".loading").fadeOut();
                shibai_alert(data.msg);
            }
        }, 'JSON');
    }

</script>
<include file="Public/foot"/>